﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

using XianShang.Data;
using XianShang.Common;
using XianShang.Entity;
using XianShang.Data.DataProvider;

namespace XianShang.Data.DataProvider
{
    public class ModuleAndMenu
    {
        /// <summary>
        /// 根據PID取得菜單
        /// </summary>
        /// <param name="moduleId"></param>
        /// <returns></returns>
        public static DataSet GetMenuByPId(string pid)
        {
            return DatabaseProvider.GetInstance().GetMenuByPId(pid);
        }
        /// <summary>
        /// 根據全部模塊信息列表
        /// </summary>
        /// <param name="moduleId"></param>
        /// <returns></returns>
        public static DataTable GetAllModuleInfo()
        {
            return DatabaseProvider.GetInstance().GetAllModuleInfo();
        }
        /// <summary>
        /// 根據用戶ID查找資源模塊
        /// 返回【ACCOUNT】、【MODULENAME】字段
        /// </summary>
        /// <param name="userid"></param>
        /// <returns></returns>
        public static DataSet GetModulesByUserId(string userid)
        {
            return DatabaseProvider.GetInstance().GetModulesByUserId(userid);
        }
        /// <summary>
        /// 根據模塊ID取得菜單
        /// </summary>
        /// <param name="moduleId"></param>
        /// <returns></returns>
        public static DataSet GetMenuByModuleId(string moduleId)
        {
            return DatabaseProvider.GetInstance().GetMenuByModuleId(moduleId);
        }
        /// <summary>
        /// 根據用戶ID取得菜單信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static DataSet GetAllMenuByUserID(string userId)
        {
            return DatabaseProvider.GetInstance().GetAllMenuByUserID(userId);
        }
        /// <summary>
        /// 根據取得所有菜單信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static DataSet GetAllMenu()
        {
            return DatabaseProvider.GetInstance().GetAllMenu();
        }
        /// <summary>
        /// 根據ID取得菜單信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static DataSet GetMenuByMenuId(string id)
        {
            return DatabaseProvider.GetInstance().GetMenuByMenuId(id);
        }
        /// <summary>
        /// 根據ID更新MenuName MenuOrder MenuUrl lablename lableurl字段
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="order"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public static int UpDateMenuMenuNameMenuOrderMenuUrlLableNameLableUrlByMenuId(MenuInfo mi)
        {
            return DatabaseProvider.GetInstance().UpDateMenuMenuNameMenuOrderMenuUrlLableNameLableUrlByMenuId(mi);
        }
        /// <summary>
        /// 根據ID取得模塊信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static DataSet GetModuleById(string id)
        {
            return DatabaseProvider.GetInstance().GetModuleById(id);
        }
        /// <summary>
        /// 根據ID更新 Name Order字段
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        public static int UpDateModuleNameOrderById(string id, string name, string order)
        {
            return DatabaseProvider.GetInstance().UpDateModuleNameOrderById(id,name,order);
        }
        /// <summary>
        /// 添加菜單
        /// </summary>
        /// <param name="mi"></param>
        /// <returns></returns>
        public static int AddMenu(MenuInfo mi)
        {
            return DatabaseProvider.GetInstance().AddMenu(mi);
        }
        /// <summary>
        /// 刪除菜單
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int DelMenu(string id)
        {
            return DatabaseProvider.GetInstance().DelMenu(id);
        }
    }
}
